package socket;

import java.lang.reflect.Array;
import java.util.Arrays;

/**
 * 测试从数组中删除指定元素的逻辑
 */
public class Test {
    public static void main(String[] args) {
        int[] allOut={1,2,3,4,5,6,7,8,9};
        int pw = 2;
        System.out.println(Arrays.toString(allOut));
        //将pw的值从数组allOut中删除
        for (int i = 0; i < allOut.length-1; i++) {
            if (allOut[i]==pw){
               allOut[i] = allOut[allOut.length-1];
                allOut = Arrays.copyOf(allOut,allOut.length-1);
                break;
            }
        }







        System.out.println(Arrays.toString(allOut));
    }
}
